package com.bocloud.cmp.server.controller.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.bocloud.cmp.interfaces.config.DictService;
import com.bocloud.common.model.BsmResult;
import com.bocloud.common.utils.Common;

/**
 * 字典信息控制器
 * 
 * @author dmw
 *
 */
@RestController
@RequestMapping("/dict")
public class DictController {
	@Autowired
	private DictService dictService;

	@RequestMapping(value = "/list", method = { RequestMethod.POST })
	public BsmResult list(@RequestParam(value = Common.VALUE, required = false) String value) {
		return dictService.list(value);
	}

	/**
	 * 根据字典值获取子节点列表
	 * 
	 * @param category
	 * @return
	 */
	@RequestMapping(value = "/children", method = { RequestMethod.GET })
	public BsmResult children(@RequestParam(value = Common.VALUE, required = false) String value) {
		return dictService.listChild(value);
	}
}
